package mysql

import "gorm.io/gorm"

type Mooc struct {
	gorm.Model
	UserId     int64  `gorm:"type:int;comment:用户id"`
	MoocName   string `gorm:"type:varchar(30);comment:名称"`
	Price      int64  `gorm:"type:int;comment:价格"`
	MoocCover  string `gorm:"type:varchar(200);comment:封面"`
	MoocStatus int64  `gorm:"type:tinyint(1);default:1;comment:1:待出售,2:上架,3下架"`
}

func (m *Mooc) MoocView(moocId int64) error {
	return Db.Where("id = ?", moocId).Limit(1).Find(&m).Error
}
